package com.hd.trans.db.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.alibaba.fastjson.annotation.JSONField;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.chad.library.adapter.base.entity.node.BaseNode;
import com.google.gson.annotations.SerializedName;
import com.hd.trans.common.Constants;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Unique;

import java.util.List;
import java.util.Objects;


/**
 * Author:  yang
 * Date:    2020/01/03 11:36
 * Desc:    语言
 */
@Entity
//        (indexes = {
//        @Index(value = "dev_type DESC")
//})
public class HuDunLanguage extends BaseNode implements Parcelable, MultiItemEntity {

    @Id(autoincrement = true)
    private Long id;

    @Unique
    @Property(nameInDb = "language_name")
    @JSONField(name = "name")
    @SerializedName("name")
    private String name;//语言名

    @Property(nameInDb = "language_short_name")
    @JSONField(name = "short_name")
    @SerializedName("short_name")
    private String shortName;//语言简称

    @Property(nameInDb = "translate_code")
    @JSONField(name = "translate_code")
    @SerializedName("translate_code")
    private String translateCode;//语言文本翻译码

    @Property(nameInDb = "recognition_code")
    @JSONField(name = "recognition_code")
    @SerializedName("recognition_code")
    private String recognitionCode;//语言语音识别码

    @Property(nameInDb = "file_recognition_code")
    @JSONField(name = "file_recognition_code")
    @SerializedName("file_recognition_code")
    private String fileRecognitionCode;//文件识别码


    @Property(nameInDb = "tts_code")
    @JSONField(name = "tts_code")
    @SerializedName("tts_code")
    private String ttsCode;//tts code

    @Property(nameInDb = "first_letter")
    @JSONField(name = "first_letter")
    @SerializedName("first_letter")
    private String firstLetter;//拼音首字母

    @Property(nameInDb = "support_voice")
    @JSONField(name = "support_voice")
    @SerializedName("support_voice")
    private int supportVoice;//是否支持语音翻译


    @Property(nameInDb = "ali_app_key")
    @JSONField(name = "ali_app_key")
    @SerializedName("ali_app_key")
    private String aliAppKey;//阿里云语音识别码

    @Property(nameInDb = "support_discern")
    @JSONField(name = "support_discern")
    @SerializedName("support_discern")
    private int supportDiscern;//是否支持识别

    protected HuDunLanguage(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        name = in.readString();
        shortName = in.readString();
        translateCode = in.readString();
        recognitionCode = in.readString();
        fileRecognitionCode = in.readString();
        ttsCode = in.readString();
        firstLetter = in.readString();
        supportVoice = in.readInt();
        aliAppKey = in.readString();
        supportDiscern = in.readInt();
    }

    @Generated(hash = 1812043774)
    public HuDunLanguage(Long id, String name, String shortName, String translateCode, String recognitionCode, String fileRecognitionCode,
            String ttsCode, String firstLetter, int supportVoice, String aliAppKey, int supportDiscern) {
        this.id = id;
        this.name = name;
        this.shortName = shortName;
        this.translateCode = translateCode;
        this.recognitionCode = recognitionCode;
        this.fileRecognitionCode = fileRecognitionCode;
        this.ttsCode = ttsCode;
        this.firstLetter = firstLetter;
        this.supportVoice = supportVoice;
        this.aliAppKey = aliAppKey;
        this.supportDiscern = supportDiscern;
    }

    @Generated(hash = 528994530)
    public HuDunLanguage() {
    }


    public static final Creator<HuDunLanguage> CREATOR = new Creator<HuDunLanguage>() {
        @Override
        public HuDunLanguage createFromParcel(Parcel in) {
            return new HuDunLanguage(in);
        }

        @Override
        public HuDunLanguage[] newArray(int size) {
            return new HuDunLanguage[size];
        }
    };




    @Override
    public List<BaseNode> getChildNode() {
        return null;
    }

    @Override
    public int getItemType() {
        return Constants.LevelType.CHILD;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        HuDunLanguage that = (HuDunLanguage) o;
        return supportVoice == that.supportVoice &&
                Objects.equals(id, that.id) &&
                Objects.equals(name, that.name) &&
                Objects.equals(shortName, that.shortName) &&
                Objects.equals(translateCode, that.translateCode) &&
                Objects.equals(recognitionCode, that.recognitionCode) &&
                Objects.equals(fileRecognitionCode, that.fileRecognitionCode) &&
                Objects.equals(ttsCode, that.ttsCode) &&
                Objects.equals(firstLetter, that.firstLetter) &&
                Objects.equals(supportDiscern, that.supportDiscern);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, shortName, translateCode, recognitionCode, fileRecognitionCode, ttsCode, firstLetter, supportVoice, supportDiscern);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getShortName() {
        return this.shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public String getTranslateCode() {
        return this.translateCode;
    }

    public void setTranslateCode(String translateCode) {
        this.translateCode = translateCode;
    }

    public String getRecognitionCode() {
        return this.recognitionCode;
    }

    public void setRecognitionCode(String recognitionCode) {
        this.recognitionCode = recognitionCode;
    }

    public String getTtsCode() {
        return this.ttsCode;
    }

    public void setTtsCode(String ttsCode) {
        this.ttsCode = ttsCode;
    }

    public String getFirstLetter() {
        return this.firstLetter;
    }

    public void setFirstLetter(String firstLetter) {
        this.firstLetter = firstLetter;
    }

    public int getSupportVoice() {
        return this.supportVoice;
    }

    public void setSupportVoice(int supportVoice) {
        this.supportVoice = supportVoice;
    }

    public int getSupportDiscern() {
        return this.supportDiscern;
    }

    public void setSupportDiscern(int supportDiscern) {
        this.supportDiscern = supportDiscern;
    }

    public String getFileRecognitionCode() {
        return this.fileRecognitionCode;
    }

    public void setFileRecognitionCode(String fileRecognitionCode) {
        this.fileRecognitionCode = fileRecognitionCode;
    }

    public String getAliAppKey() {
        return this.aliAppKey;
    }

    public void setAliAppKey(String aliAppKey) {
        this.aliAppKey = aliAppKey;
    }
}
